package com.emm.yixun.openapi.hander;

import com.emm.yixun.common.app.servletentity.CustomerListRes;
import net.sf.ehcache.CacheManager;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.emm.yixun.common.app.GetSearchListReqDto;
import com.emm.yixun.common.app.GetSearchListResDto;
import com.emm.yixun.common.exception.XFUNExceptionCode;
import com.emm.yixun.customer.service.app.CustomerServiceAppFacade;
import com.emm.yixun.openapi.dto.base.BaseRequestDTO;
import com.emm.yixun.openapi.dto.base.BaseResponseDTO;
import com.emm.yixun.openapi.hander.base.CommonAbstractHander;
import com.emm.yixun.openapi.vo.GetSearchListReqVo;

/**
 * 客户搜索
 * @author Administrator
 *
 */
@Service("getSearchListHander")
public class GetSearchListHander extends CommonAbstractHander{
	
	@Autowired
	private CustomerServiceAppFacade customerServiceAppFacade;
	@Autowired
	private CacheManager cacheManager;
	
	@SuppressWarnings("rawtypes")
	@Override
	public BaseResponseDTO doBusiness(BaseRequestDTO reqDto) {
		GetSearchListReqVo req = (GetSearchListReqVo)reqDto;
		GetSearchListReqDto reqDto1 = req.getParams();
		BaseResponseDTO<GetSearchListResDto> res = new BaseResponseDTO<GetSearchListResDto>();
		GetSearchListResDto resDto = new GetSearchListResDto();
		try{
			resDto = customerServiceAppFacade.getSearchList(reqDto1);
		} catch (Exception e) {
			resDto.setErrorCode(XFUNExceptionCode.UNKNOW_EXCEPTON.getCode());
			resDto.setErrorMsg(XFUNExceptionCode.UNKNOW_EXCEPTON.getDesout());
			resDto.setResult("0");
		}
		res.setResData(resDto);
		return res;
	}
	
}
